package com.mi.global.shop.common.utils;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;

/**
 * Created by laihengyu on 2017/11/2.
 */

public class TimeFormaterUtil {
    //单位毫秒
    private static final long ONE_HOUR = 60 * 60 * 1000;
    private static final long ONE_DAY = ONE_HOUR * 24;

    // 24小时之内用—— 23:00
    // 其他用 31-10-2017
    public static String formatNotificationTime(long timestamp) {
        return new SimpleDateFormat("HH:mm", Locale.ENGLISH).format(new Date(timestamp));
/*        Date now = new Date(timestamp);
        Long diff = System.currentTimeMillis() - timestamp * 1000;
        if (diff >= 0 && diff < ONE_DAY) {
            return new SimpleDateFormat("HH:mm", Locale.ENGLISH).format(now);
        } else {
            return new SimpleDateFormat("dd-MM-yyyy", Locale.ENGLISH).format(now);
        }*/
    }
}
